/************************************************************************
 *				SRLOS Team CopyRight
 *@file		mt_mutex.h
 *@author	bloceanc
 *@date		7/21/2010
 *@note		kernel mutex
 ************************************************************************/
#ifndef	_MT_MUTEX_H_
#define	_MT_MUTEX_H_

struct thread_struct;	/* defined in task.h */

/*
 * comments:
 * 	like kvm mutex, mangered in thread unit!
 * used in kernel or global module!
 */
typedef	struct __k_mutex{
	unsigned int depth;	/* current lock depth */
	struct thread_struct *owner;	/* mutex current owner */
	struct thread_struct *wait_list;	/* thread list waitting for current mutex */
	struct __k_mutex *next;
	struct __k_mutex *prev;
}k_mutex;

/*
 * 	mutex block
 * 		used in process unit
 */
typedef	struct __mutex_block{
	k_mutex	*mutex;	/* mutex boddy */
	struct __mutex_block *next;	/* mutex list, the next field */
	struct __mutex_block *prev;	/* previous field */
}mutex_block;

#endif	/* _MT_MUTEX_H_ */
